#ifndef FCB_SNACKBAR_INTERNAL_H
#define FCB_SNACKBAR_INTERNAL_H

#include <QStateMachine>
#include <QTimer>

class Snackbar;

class SnackbarStateMachine : public QStateMachine
{
    Q_OBJECT

    Q_PROPERTY(qreal offset WRITE setOffset READ offset)

public:
    SnackbarStateMachine(Snackbar *parent);
    ~SnackbarStateMachine();

    void setOffset(qreal offset);
    inline qreal offset() const;

public slots:
    void progress();

protected slots:
    void snackbarShown();

protected:
    bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;

private:
    Q_DISABLE_COPY(SnackbarStateMachine)

    Snackbar *const m_snackbar;
    QTimer                    m_timer;
    qreal                     m_offset;
};

inline qreal SnackbarStateMachine::offset() const
{
    return m_offset;
}

#endif // FCB_SNACKBAR_INTERNAL_H
